<?php
class story{
	function selectStory()
	{
		global $con;
		$sql="select * from tbl_story";
		$res = mysqli_query($con,$sql);
		return $res;
	}/// EOF
	function selectedStory()
	{
		global $con;
		$sql="select * from tbl_story WHERE story_status='1'";
		$res = mysqli_query($con,$sql);
		return $res;
	}/// EOF
	
	function addStory($story_title,$story_short_des,$story_des,$status,$story_add_date,$story_image)
	{
		global $con;
		$sql="INSERT INTO tbl_story SET 
			story_title='$story_title', 
			story_short_des='$story_short_des',
			story_des='$story_des',
			story_status='$status', 
			story_added_date='$story_add_date', 
			story_image='$cors_image'";
		mysqli_query($con,$sql);
	}/// EOF
	function deleteStory($id)
	{
		global $con;
		$sql="DELETE FROM tbl_story WHERE story_id='$id' ";
		mysqli_query($con,$sql);
		}
	function editStory($storyId,$story_title,$story_short_des,$story_des,$status,$story_add_date,$story_image)
	{
		global $con;
		$sql="UPDATE tbl_story SET 
			story_title='$story_title',
			story_short_des='$story_short_des', 
			story_des='$story_des',
			story_status='$status',
			story_added_date='$story_add_date', 
			story_image='$story_image' 
			WHERE 
			story_id='$storyId'";
		mysqli_query($con,$sql);
	}	
	function getStoryById($id)
	{
		global $con;
		$sql="SELECT *FROM tbl_story WHERE story_id='$id'";
		$res=mysqli_query($con,$sql);
		return $res;	
	}
	function storyStatus($status,$Id){
		global $con;
		$sql="UPDATE tbl_story SET story_status='$status' WHERE story_id='$Id'";
		mysqli_query($con,$sql);
	}
	
}//EOC


$objStory=new story();
?>
